import keyword as k
import os
str1 = "laowang"
print(len(str1))
print(k.kwlist)

#name = input("输入姓名：")
name="liujianlin"
for i in name:
    print(i)
else:
    print("over")

print(name[1])
print(name[-1])

print("aa=%sand bb=%s,qie=%s"%(name[1],name[-1],name[2:4]))


print(name[-1::-2])

print(name[::-1])

myStr = "it cast study!"
index = myStr.find("c")
print(index)

def hello():
    print("hello")

def sum(num1,num2):
    hello()
    return num1+num2;

def jia(num):
    if num> 1:
       return num * jia(num-1)
    else:
      return  num

hello()
print("1+2=%d"%sum(1,2))

print("5!=%d"%jia(5))



a =[100]
def test(num):
    #num = num+num
    num += num
    print(num)
test(a)
print(a)


print("-------------------------------\n")

f = open("f:/zl2.txt","w+")
#print(type(f))

f.write("aaaaa\nbbbbbbbb\nccccccc")
f.write("liujianlin")
f.flush()
f.seek(2)
print(f.read())
f.close()


#os.rename("f:/zl2.mp4","f:/zl2.txt")
#print(os.getcwd())
#os.chdir("f:/mygit/python")
print(os.getcwd())

print(os.listdir("f:/mygit/python"))



class A:
    num = 3
    def __init__(self):
        self.num = 111
    @classmethod
    def set_num(c):
        c.num = 200
    @staticmethod
    def show():
        print("static method")

a = A()
print(a.num)
a.set_num()
print(A.num)
A.show()